#pragma once
#include <winsock2.h>
#include <Windows.h>
#include "ClientNetwork.h"
#include "Bind_Operation.h"
#include "Search_Operation.h"
#include "Delete_Operation.h"
#include "Modify_Operation.h"
#include "Compare_Operation.h"
#include "AddEntry.h"
#include "Unbind.h"
#include "Filter.h"
#include "Bind_Result.h"
#include "Compare_Result.h"
#include "Search_Result.h"

/*
un client cu permisiuni doar de citire a intrarilor
*/


class Client
{
protected:

	char network_data[MAX_PACKET_SIZE];

	ClientNetwork* network;

	char *CommonName;
	char *OrganizationalUnit;
	char **DomainName;
	int DomainName_level;
	char *ClientDN;
	char *ClientDC;

	bool Auth_state;
	bool isConnected;


	void generateClientDN_DC();

	 char* update();

public:
	Client(char *CN,char *OU,char **DN,int DN_level);

	Client(char *CN,char **DN,int DN_level);

	~Client(void);

	void connectToServer(char* ServerIPAdd,int portNumber);

	bool sendActionPackets(LDAP_Operation *);

	bool sendActionPackets(char *file_name);

	void compareAtribute(char *dn,int auth_type,char **option,int nr_opt,char *ldap_URI,vector<Atribut<char*>> filtru);

	void Bind(char *User_name,char *Password);

	void Search(int auth_type,char **ldapOptions,int nr_opt,char *ldap_URI, bool search_base ,vector<Atribut<char*>> filtru);

	void Search(int auth_type,char **ldapOptions,int nr_opt,char *ldap_URI, bool search_base);

	void Unbind_();
};

